package com.hsteach.service.myopia;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.hsteach.dao.domain.myopia.MyopiaMission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Description:
 * @Author: lx
 * @Date: 2024/1/5 11:00
 */
@Component
public class InspectionTask {

    @Autowired
    private MyopiaMissionService missionService;

//    @Scheduled(cron = "0 */1 * * * ?")
    public void inspection() {
        //更改到期任务
        missionService.update(new LambdaUpdateWrapper<MyopiaMission>()
                .set(MyopiaMission::getStatus, 2)
                .eq(MyopiaMission::getStatus,0)
                .eq(MyopiaMission::getDelFlag, 0)
                .le(MyopiaMission::getEndTime, new Date()));
    }
}
